/*
 * @Description:
 * @Author: Tsingwong
 * @Date: 2020-11-27 11:03:13
 * @LastEditors: Tsingwong
 * @LastEditTime: 2020-11-27 17:25:57
 */
import { fromJS } from 'immutable'
import * as constants from './actionType'

const defaultState = fromJS({
  title: '',
  content: '',
})

export default (prevState = defaultState, action) => {
  switch (action.type) {
    case constants.SET_DETAIL_DATA: {
      const { title, content } = action
      return prevState.merge({
        title,
        content,
      })
    }
    default:
      return prevState
  }
}
